<template>
    <view>
        <view v-for="(item,index) in array" :key="index" class="detailed">
            <view class="flex detailed-title ">{{item.title}}</view>
            <view class="flex detailed-time">{{item.time}}</view>
            <view class="flex detailed-content">{{item.contont}}</view>
            <view class="detailed_img" v-html="item.image"></view>
        </view>
    </view>
</template>

<script>
import {
    request
} from "../../../comon/js/request.js"
export default {
    data() {
        return {
            id: 0,
            array: [{
                title: "",
                time: "",
                contont: ""
            }]
        }
    },
    onLoad(option) {
        this.id = option.id
        this.getMsg()
    },
    methods: {
        getMsg() {
            request({
                url: "v1/news/detail/" + this.id
            }).then(res => {
                console.log(res)
                this.array[0].title = res.data.result.title
                this.array[0].time = res.data.result.created_at
                this.array[0].image = res.data.result.content.replace(/\<img/gi, '<img class="rich-img" ');
                this.array[0].contont = res.data.result.alias

            });
        }
    }
}
</script>

<style lang="less">
.flex {
    display: flex;
    justify-content: center;
}

.detailed {
    padding-left: 5rpx;
    padding-right: 5rpx;

    .detailed-title {
        font-size: 20px;
        color: #222222;
        letter-spacing: 0;
        text-align: center;
        line-height: 20px;
        margin-top: 30rpx;
    }

    .detailed-time {
        font-size: 12px;
        color: #959595;
        letter-spacing: 0;
        text-align: center;
        line-height: 12px;
        margin-top: 20rpx;
    }

    .detailed_img {
        text-align: justify;
        width: 682rpx;
        margin-top: 20rpx;
        font-size: 28rpx;
        padding: -43prx;
        margin: 0 auto;

    }

    .detailed_img .rich-img {
        max-width: 100%;
    }

    .detailed-content {
        font-size: 12px;
        line-height: 22px;
    }
}
</style>
